<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<div id="root" style="width: 100px;height: 100px; background-color: blue">
    <label>
        <input type="text"  @keyup="up" placeholder="输入数据打印数据"  />
    </label>
    <!--    输入数据按enter键打印数据值-->
    <label>
        <input @keydown.enter="down" placeholder="输入数据打印数据" type="text"/>
    </label>
    <label>
        <input @keydown.delete="deleteWay()" placeholder="输入数据打印数据" type="text"/>
    </label>


</div>


<script src="script/vue.js"></script>

<script>
    let vue2 = new Vue({
        el: '#root',
        methods: {
            up(e) {
                console.log(e.target.value);
            },
            down(e) {
                console.log(e.target.value);
            },
            deleteWay(e) {
                alert("删除了数据");
            }
        }
    });

    Vue.config.keyCodes.test = 16;
</script>
</body>
</html>
